// eslint-disable-next-line import/namespace
const jsonwebtoken = require('jsonwebtoken')
class GenJSONWebToken {
  _SECRET = 'kennana' // 随意输入
  _loginData = {}
  constructor(loginData) {
    this._loginData = loginData
  }

  genToken() {
    const SECRET = this._SECRET
    return jsonwebtoken.sign({ username: this._loginData.username }, SECRET, {
      expiresIn: '24h',
    })
  }
}
module.exports = GenJSONWebToken
